package cn.edu.scut.sys.json;

import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class CustomTimestampSerializer extends  JsonSerializer<Timestamp>{

	@Override
	public void serialize(Timestamp time, JsonGenerator jgen,
			SerializerProvider serializer) throws IOException,
			JsonProcessingException {
		SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd");
		String str = fm.format(time);
		jgen.writeString(str);
		
	}

}
